<%@ page language="java" pageEncoding="UTF-8"%>
<%@ include file="../../../taglib.jsp"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"+ request.getServerName() + ":" + request.getServerPort()+ path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<easyui:list>
<html>
<head>
<base href="<%=basePath%>" />
<title></title>
<%@ include file="/webmodules/console/css.jsp"%>
<%@ include file="/webmodules/console/js.jsp"%>
<script type="text/javascript">
${js}
function force(){
	 var rows = $('#mydatagrid').datagrid('getSelections');	
		if (rows.length > 0){
			var ids = new Array();
			for ( var i = 0; i < rows.length; i++) {
				if(rows[i].ISLEAF=="1"){
					ids.push(rows[i].ID);
				}
			}
			if(ids.length>0){
				$.post("dragon/modules/system/dic/action/DicHandler/changeIsLeaf.ejw",{ids:ids.join(",")},function(data) { 
					if(data.result !=undefined && data.result == true){
						$('#mydatagrid').datagrid('reload');
					}
					if(data.MESSAGE_ERROR != undefined && data.MESSAGE_ERROR != ''){
						top.showMsg("错误", data.MESSAGE_ERROR, true,'error');
					}else if(data.MESSAGE_WARNING != undefined && data.MESSAGE_WARNING != ''){
						top.showMsg("警告", data.MESSAGE_WARNING, true,'warning');
					}else if(data.MESSAGE_INFO != undefined && data.MESSAGE_INFO != ''){
						top.showMsg("", data.MESSAGE_INFO, false);
					}
		 		},'json');
			}
		}else{
			top.showMsg("", "请选择要操作的数据！", true);
		}
}
function Xdelete(){
	 var rows = $('#mydatagrid').datagrid('getSelections');
		if (rows.length > 0){
			
				var ids = new Array();
				for ( var i = 0; i < rows.length; i++) {
					if(rows[i].STATE=="1"){
					ids.push(rows[i].ID);
					}
				}
				$.post("dragon/modules/system/dic/action/DicHandler/changeState.ejw",{ids:ids.join(","),state:0},function(data) { 
					if(data.result !=undefined && data.result == true){
						$('#mydatagrid').datagrid('reload');
						top.showMsg("", "操作成功！", false);
					}
					if(data.MESSAGE_ERROR != undefined && data.MESSAGE_ERROR != ''){
						top.showMsg("错误", data.MESSAGE_ERROR, true,'error');
					}else if(data.MESSAGE_WARNING != undefined && data.MESSAGE_WARNING != ''){
						top.showMsg("警告", data.MESSAGE_WARNING, true,'warning');
					}else if(data.MESSAGE_INFO != undefined && data.MESSAGE_INFO != ''){
						top.showMsg("", data.MESSAGE_INFO, false);
					}
		 		},'json'); 

		}else{
			top.showMsg("", "请选择要操作的数据！", true);
		}
}
function goback(){
	 var rows = $('#mydatagrid').datagrid('getSelections');	
		if (rows.length > 0){
				var ids = new Array();
				for ( var i = 0; i < rows.length; i++) {
					if(rows[i].STATE=="0"){
						ids.push(rows[i].ID);
						}
				}
				$.post("dragon/modules/system/dic/action/DicHandler/changeState.ejw",{ids:ids.join(","),state:1},function(data) { 
					if(data.result !=undefined && data.result == true){
						$('#mydatagrid').datagrid('reload');
						top.showMsg("", "操作成功！", false);
					}
					if(data.MESSAGE_ERROR != undefined && data.MESSAGE_ERROR != ''){
						top.showMsg("错误", data.MESSAGE_ERROR, true,'error');
					}else if(data.MESSAGE_WARNING != undefined && data.MESSAGE_WARNING != ''){
						top.showMsg("警告", data.MESSAGE_WARNING, true,'warning');
					}else if(data.MESSAGE_INFO != undefined && data.MESSAGE_INFO != ''){
						top.showMsg("", data.MESSAGE_INFO, false);
					}
		 		},'json'); 
		}else{
			top.showMsg("", "请选择要操作的数据！", true);
		}
}
</script>
</head>
<body>
${html}
</body>
</html>
</easyui:list>